package com.yooop.study.singleton.staticinnerclass;

import com.yooop.study.singleton.IAction;

/**
 * @author yaopin
 * @since 2025/2/12 20:46
 * Copyright © 2025 Bahamut.NetEase. All rights reserved.
 */
public class Singleton implements IAction {

    // 私有化构造方法
    private Singleton () {}

    // 对外提供获取实例的公共方法
    public static Singleton getInstance() {
        return InnerSingleton.INSTANCE;
    }

    // 静态内部类
    private static class InnerSingleton {

        private static final Singleton INSTANCE = new Singleton();
    }

    public void action() {
        System.out.println("Here is staticInnerClass");
    }
}
